package com.github.shiqiyue.app.api.sapi.result.user;

import com.github.shiqiyue.app.modules.sys.entity.User;
import lombok.Data;

import java.util.Date;

/***
 * 用户详细信息-DTO
 * @author wenyao.wu
 * @date 2019/7/17
 */
@Data
public class UserDetailResult {

    private Long id;

    private Date addDate;

    /***
     * 用户名
     */
    private String name;

    /***
     * 个人介绍
     */
    private String introduction;

    /**
     * 状态
     */
    private Integer status;

    /**
     * 头像
     */
    private String avatar;


    public UserDetailResult() {
    }

    public static UserDetailResult newInstance(User user) {
        if (user == null) {
            return null;
        }
        UserDetailResult userDetailResult = new UserDetailResult();
        userDetailResult.setName(user.getName());
        userDetailResult.setIntroduction(user.getIntroduction());
        userDetailResult.setStatus(user.getStatus().getValue());
        userDetailResult.setAvatar(user.getAvatar());
        userDetailResult.setId(user.getId());
        userDetailResult.setAddDate(user.getAddDate());
        return userDetailResult;
    }
}
